履歴: 電気回路/zynq/Petalinux のカスタマイズ
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 15 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2019/3/20 16:17:29 | 電気回路/zynq/Petalinux のカスタマイズ 最新版 | 47,912 | +1 | -2 | 表示 | 差分 | — |
| 2017/3/22 4:54:30 | 電気回路/zynq/Petalinux のカスタマイズ | 47,904 | +5 | -3 | 表示 | 差分 | 選択 |
| 2017/3/22 4:54:30 | 電気回路/zynq/Petalinux のカスタマイズ | 47,860 | +80 | -26 | 表示 | 差分 | 選択 |
| 2017/2/24 12:48:31 | 電気回路/zynq/Petalinux のカスタマイズ | 45,959 | +13 | -6 | 表示 | 表示中 | 選択 |
| 2017/2/24 12:48:31 | 電気回路/zynq/Petalinux のカスタマイズ | 45,759 | +15 | -7 | 表示 | 差分 | 選択 |
| 2017/2/24 12:48:31 | 電気回路/zynq/Petalinux のカスタマイズ | 45,570 | +72 | -26 | 表示 | 差分 | 選択 |
| 2017/2/24 6:27:32 | 電気回路/zynq/Petalinux のカスタマイズ | 43,807 | +180 | -21 | 表示 | 差分 | 選択 |
| 2017/2/23 22:19:22 | 電気回路/zynq/Petalinux のカスタマイズ | 38,925 | +53 | -28 | 表示 | 差分 | 選択 |
| 2017/2/23 16:38:24 | 電気回路/zynq/Petalinux のカスタマイズ | 38,730 | +259 | -160 | 表示 | 差分 | 基準 |
| 2017/2/23 10:27:23 | 電気回路/zynq/Petalinux のカスタマイズ | 33,288 | +568 | -1 | 表示 | 差分 | 選択 |
| 2017/2/20 18:04:09 | 電気回路/zynq/Petalinux のカスタマイズ | 8,009 | +54 | -0 | 表示 | 差分 | 選択 |
| 2017/2/20 9:44:23 | 電気回路/zynq/Petalinux のカスタマイズ | 6,485 | +99 | -50 | 表示 | 差分 | 選択 |
| 2017/2/20 4:03:13 | 電気回路/zynq/Petalinux のカスタマイズ | 4,641 | +123 | -11 | 表示 | 差分 | 選択 |
| 2017/2/16 18:16:25 | 電気回路/zynq/Petalinux のカスタマイズ | 1,991 | +51 | -5 | 表示 | 差分 | 選択 |
| 2017/2/16 16:44:09 | 電気回路/zynq/Petalinux のカスタマイズ | 562 | — | — | 表示 | — | 選択 |
基準: 電気回路/zynq/Petalinux のカスタマイズ (2017/2/23 16:38:24) → 比較: 電気回路/zynq/Petalinux のカスタマイズ (2017/2/24 12:48:31)
@@ -44,12 +44,12 @@
$ set | grep PETA
PETALINUX=/home/osamu/z-turn/petalinux
PETALINUX_VER=2016.4
- $ petalinux-^t
+ $ petalinux-^T
petalinux-boot petalinux-config petalinux-package petalinux-util
petalinux-build petalinux-create petalinux-setup
- $ petalinux-^c
+ $ petalinux-^C
$ cat >> ~/.bashrc # 自動実行スクリプトに登録する
- alias petalinux-setup='export LANG=C; source ~/z-turn/petalinux/settings.sh'
+ alias petalinux-setup='source ~/z-turn/petalinux/settings.sh'
alias petalinux-boot='LANG=C petalinux-boot'
alias petalinux-build='LANG=C petalinux-build'
alias petalinux-config='LANG=C petalinux-config'
@@ -73,9 +73,11 @@
の2つのファイルに起動に必要なすべてのファイルをまとめるようになっています。
-BOOT.BIN はまあこれでもいいとして、
-image.ub については中の dtb, uImage, rootfs をすべて別々にしておいた方が、
-個別にビルドできて便利です。
+しかし開発においては
+BOOT.BIN の中の design.bit や、
+image.ub の中の dtb, uImage, rootfs は頻繁に変更したくなるため、
+すべて別々のファイルにしておいた方が、
+個別にビルド&デプロイできて便利です。
ということで、設定を変更してみます。
@@ -89,6 +91,9 @@
としました。
+/dev/sdf に SD カードが見えている状況で、~
+(参考: [[[VirtualBox へ SD カードをマウントする]>電気回路/z-turn/VirtualBox に Debia8 を入れる#g8dc93aa]])
+
LANG:console
$ petalinux-setup
$ petalinux-config
@@ -745,6 +750,8 @@
待ち時間も無く u-boot が起動して、上記の fatload & fpga loadb
でプログラムできることがわかった。
+=>今現在、なんか、起動できるときと起動できないときがあって、理由がまだ分からないので、
+これ、抜いちゃダメな可能性もあります。
** ここまでのまとめ [#yf9ae71c]
最終的な SD カードの構成と、
@@ -759,7 +766,7 @@
-- devicetree.dtb : テキストエディタで作成
-- uImage : petalinux-package --image -c kernel --format uImage
- /dev/mmcblk0p2
--- / : Debian
+-- / : Ubuntu 16.04
-- /lib/modules/4.6.0-xilinx/ : カーネルソースから作成
* カーネルをソースから make [#g5728922]
@@ -777,14 +784,21 @@
で、探してみると~
(petalinux-project-dir)/build/tmp/work-shared/plnx_arm/kernel-build-artifacts/ ~
-に .config やら何やらがある。どうやって使うのだろう???
+に .config やら何やらがある。
-試しに上記 kernel-source/* と kernel-build-artifacts/.config とを
-kernel-source/ にコピーして、
+どうやって使うのだろう???
+まずは上記 (petalinux-project-dir)/build/tmp/work-shared/plnx_arm/kernel-source/* と~
+(petalinux-project-dir)/build/tmp/work-shared/plnx_arm/kernel-build-artifacts/.config とを
+~~/z-turn/kernel-source/ にコピーしてビルドしてみる。
+
LANG:console
+ $ cd ~/z-turn
$ cp -R build/tmp/work-shared/plnx_arm/kernel-source/ .
$ cp build/tmp/work-shared/plnx_arm/kernel-build-artifacts/.config kernel-source/
+ $ git add -f kernel-source/.config
+ $ echo "/kernel-source" >> .gitignore
+ $ git commit -m "kernel: petalinux's default config"
$ cd kernel-source/
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
CHK include/config/kernel.release
@@ -821,9 +835,10 @@
pr_err("Bitstream does not match the device\n",
^
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
- $
-ビルドできた。kernel-source/arch/arm/boot/uImage を SD カードにコピーしたところ、
+ビルドできた。
+
+./kernel-source/arch/arm/boot/uImage を SD カードにコピーしたところ、
ちゃんと起動することを確認。
以降は、
@@ -858,12 +873,122 @@
$ petalinux-config -c rootfs
とするとこのファイルシステムに含めるパッケージを選択できるようだけれど
-一々ここまで戻らないとパッケージを追加できないのは困るのと、
-そもそも個人的に使い慣れた Debian にした方がいろいろはかどりそうなのとで、
+一々ここまで戻らないと必要なパッケージを追加できないのは困るのと、
+そもそも個人的に使い慣れた Debian 系 OS にした方がいろいろはかどりそうなのとで、
まるっと入れ替えてしまうことに。
-やり方は [[電気回路/z-turn/Linuxの設定]] を参照。
+やり方は [[電気回路/z-turn/Linuxの設定]] と同様ですが、ここでは libmetal 用に
+libhugetlbfs が必要なので、Ubuntu 16.04 を入れました。
+VirtualBox 内の Ubuntu から、
+
+ LANG:console
+ $ sudo apt-get install qemu-user-static debootstrap binfmt-support
+ $ export targetdir=~/z-turn/rootfs
+ $ export distro=xenial
+ $ mkdir -p $targetdir
+ $ sudo debootstrap --arch=armhf --foreign $distro $targetdir
+ $ sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin
+ $ sudo cp /etc/resolv.conf $targetdir/etc
+ $ sudo chroot $targetdir
+
+ LANG:console
+ $ export distro=xenial
+ $ export LANG=C
+ $ /debootstrap/debootstrap --second-stage
+ $ cat << EOT > /etc/apt/sources.list
+ # http://ascii.jp/elem/000/000/441/441502/index-3.html によれば、
+ # main が Canonical によりメンテナンスされているオープンソースウェア
+ # restricted が Canonical によりメンテナンスされているクローズウェア
+ # universe が オープンソースウェア
+ # multiverse が オープンソースでないもの
+ deb http://ports.ubuntu.com/ubuntu-ports/ $distro main restricted universe multiverse
+ deb http://ports.ubuntu.com/ubuntu-ports/ $distro-backports main restricted universe multiverse
+ deb http://ports.ubuntu.com/ubuntu-ports/ $distro-security main restricted universe multiverse
+ deb http://ports.ubuntu.com/ubuntu-ports/ $distro-updates main restricted universe multiverse
+ EOT
+ $ cat > /etc/apt/apt.conf.d/71-no-recommends
+ APT::Install-Recommends "0";
+ APT::Install-Suggests "0";
+ ^D
+ $ apt-get update
+ $ apt-get install locales dialog
+ $ dpkg-reconfigure locales
+ Generating locales (this might take a while)...
+ en_US.UTF-8... done
+ ja_JP.UTF-8... done
+ Generation complete.
+ $ apt-get install etckeeper # /etc 以下の更新履歴を取る
+ $ apt-get dist-upgrade
+ $ apt-get install openssh-server ntpdate hwinfo ntp samba jed aptitude dbus ca-certificates
+ $ apt-get install build-essential device-tree-compiler cmake doxygen libsysfs-dev libhugetlbfs-dev
+ $ cat /etc/network/interfaces
+ # interfaces(5) file used by ifup(8) and ifdown(8)
+ # Include files from /etc/network/interfaces.d:
+ source-directory /etc/network/interfaces.d
+ $ cat << EOT > /etc/network/interfaces.d/eth0-dhcp
+ allow-hotplug eth0
+ iface eth0 inet dhcp
+ EOT
+ $ echo xenial-zynq > /etc/hostname
+ $ echo "127.0.0.1 xenial-zynq" >> /etc/hosts
+ $ echo "/dev/mmcblk0p1 /boot auto defaults 0 0" >> /etc/fstab
+ $ adduser osamu
+ $ adduser osamu sudo
+ Adding user `osamu' to group `sudo' ...
+ Adding user osamu to group sudo
+ Done.
+ $ su osamu
+ $ groups
+ osamu sudo
+ $ exit
+ $ jed /etc/samba/smb.conf
+ [global]
+ + # プリンタ関連の警告が出ないようにする
+ + printing = bsd
+ + load printers = no
+ + printcap name = /dev/null
+ ...
+ [homes]
+ ...
+ - read only = yes
+ + # ホームディレクトリを書き込み可能にする
+ + read only = no
+ ...
+ + # /boot 以下を共有する
+ + [boot]
+ + path = /boot
+ + force group = root
+ + force user = root
+ + create mode = 600
+ + directory mode = 755
+ + valid user = osamu
+ + writable = yes
+ $ # samba インストール前に作られた既存ユーザーについては
+ $ # 別途 samba に登録してやる必要がある
+ $ pdbedit -a -u osamu
+ new password:
+ retype new password:
+ $ exit
+
+ LANG:console
+ $ sudo mount /dev/sdf2 /mnt/sdcard2/
+ $ sudo cp -a ~/z-turn/rootfs/* /mnt/sdcard2/
+ $ sudo umount /dev/sdf2
+
+Ubuntu の場合、手作業で inittab にシリアルポート番号を指定しなくても
+ちゃんと ttyPS1 にログインシェルを開いてくれました。
+
+** dbus がインストールされていなかった [#o10dc16f]
+
+ LANG:console
+ $ sudo shutdown 0
+ Failed to connect to bus: そのようなファイルやディレクトリはありません
+ $ sudo apt-get install dbus
+ $ sudo shutdown 0
+
+これで問題なくシャットダウンできるようになった。
+
* 全体のまとめ [#p4f8f224]
もう一度はじめから、全手順を確認してみます。
@@ -882,12 +1007,30 @@
> /components
> /BOOT.BIN
> *~
+ > *.old
> EOT
+ $ git add .
+ $ git commit -m "newly created"
$ petalinux-config --get-hw-description=../design_1_wrapper_hw_platform_1/
Linux Components Selection --->
[Uncheck] First Stage Bootloaer
Auto Config Settings --->
[Uncheck] fsbl autoconfig
+ Subsystem AUTO Hardware Settings --->
+ Advanced bootable images storage Settings --->
+ kernel image settings --->
+ image storage media --->
+ primary sd
+ dtb image settings --->
+ image storage media --->
+ primary sd
+ Image Packaging Configuration --->
+ Root filesystem type --->
+ SD card
+ [Uncheck] Copy final images to tftpboot
+ u-boot Configuration --->
+ U-boot config --->
+ other
Yocto Settings --->
Parallel thread execution --->
BB_NUMBER_THREADS = 4
@@ -907,20 +1050,6 @@
NOTE: Tasks Summary: Attempted 1793 tasks of which 1378 didn't need to be rerun and all succeeded.
Summary: There was 1 WARNING message shown.
- Error in atexit._run_exitfuncs:
- Traceback (most recent call last):
- File "/home/osamu/z-turn/petalinux/components/yocto/source/arm/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
- func(*targs, **kargs)
- File "/home/osamu/z-turn/petalinux/components/yocto/source/arm/layers/poky/bitbake/lib/bb/ui/knotty.py", line 226, in finish
- self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
- error: (5, 'Input/output error')
- Error in sys.exitfunc:
- Traceback (most recent call last):
- File "/home/osamu/z-turn/petalinux/components/yocto/source/arm/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
- func(*targs, **kargs)
- File "/home/osamu/z-turn/petalinux/components/yocto/source/arm/layers/poky/bitbake/lib/bb/ui/knotty.py", line 226, in finish
- self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
- termios.error: (5, 'Input/output error')
$ ls images/linux
uImage
$ ls build/tmp/deploy/images/plnx_arm/
@@ -937,22 +1066,138 @@
$ cp build/tmp/deploy/images/plnx_arm/plnx_arm-system.dtb images/linux/devicetree.dtb
$ cp ../design_1_wrapper_hw_platform_1/design_1_wrapper.bit images/linux/system.bit.bin
$ cat > images/linux/uEnv.txt
- bootargs=console=ttyPS1,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 devtmpfs.mount=0
- uenvcmd=run mmc_loadbit_fat && echo Copying Linux from SD to RAM... && mmcinfo && run load_image && bootm ${kernel_load_address} - ${devicetree_load_address}
- load_image=fatload mmc 0 ${kernel_load_address} ${kernel_image} && fatload mmc 0 ${devicetree_load_address} ${devicetree_image}
- mmc_loadbit_fat=echo Loading ${bitstream_image} to PL... && mmcinfo && fatload mmc 0 ${loadbit_addr} ${bitstream_image} && fpga loadb 0 ${loadbit_addr} ${filesize}
- ^D
+ bootargs=console=ttyPS1,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 devtmpfs.mount=0
+ uenvcmd=run mmc_loadbit_fat && echo Copying Linux from SD to RAM... && mmcinfo && run load_image && bootm ${kernel_load_address} - ${devicetree_load_address}
+ load_image=fatload mmc 0 ${kernel_load_address} ${kernel_image} && fatload mmc 0 ${devicetree_load_address} ${devicetree_image}
+ mmc_loadbit_fat=echo Loading ${bitstream_image} to PL... && mmcinfo && fatload mmc 0 ${loadbit_addr} ${bitstream_image} && fpga loadb 0 ${loadbit_addr} ${filesize}
+ ^D
$ ls images/linux
BOOT.BIN devicetree.dtb system.bit.bin u-boot.elf uEnv.txt uImage zynq_fsbl.elf
+ $ git add .
+ $ git commit -m "起動可能になった"
+
+- u-boot の confiture をしないと image.ub を読みに行ってしまいます
+- mkdir -p images/linux/ をしないと uImage などがコピーできないというエラーが出ます
+- BOOT.BIN, devicetree.dtb, system.bit.bin, uEnv.txt, uImage を SD カードの第1パーティション(FAT32 でフォーマット)にコピーします
+
+以下、カーネルソースをコンパイル可能な形にコピーし、設定後、ビルド&インストールする手順~
+
+ LANG:console
$ cp -R build/tmp/work-shared/plnx_arm/kernel-source/ .
$ cp build/tmp/work-shared/plnx_arm/kernel-build-artifacts/.config kernel-source/
+ $ cd kernel-source/
+ $ make ARCH=arm menuconfig
+ $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- UIMAGE_LOADADDR=0x8000 uImage modules
+ $ cp arch/arm/boot/uImage ../images/linux
+ $ sudo make ARCH=arm INSTALL_MOD_PATH=~/z-turn/rootfs modules_install
+ $ sudo make ARCH=arm INSTALL_MOD_PATH=~/z-turn/rootfs firmware_install
- $ petalinux-build -c u-boot
- $ ls images/linux/
- BOOT.BIN devicetree.dtb rootfs.tar.gz u-boot.bin uImage
- System.map.linux rootfs.cpio system.bit.bin u-boot.elf vmlinux
- design_1_wrapper.bit rootfs.cpio.gz system.dtb uEnv.txt zynq_fsbl.elf
+SD カードを直接更新するには
+ LANG:console
+ $ sudo mount /dev/sdf1 /mnt/sdcard1
+ $ sudo mount /dev/sdf2 /mnt/sdcard2
+ $ sudo cp arch/arm/boot/uImage /mnt/sdcard1/
+ $ sudo make ARCH=arm INSTALL_MOD_PATH=/mnt/sdcard2 modules_install
+ $ sudo make ARCH=arm INSTALL_MOD_PATH=/mnt/sdcard2 firmware_install
+ $ sudo umount /mnt/sdcard*
+* カーネル設定 [#u43d03eb]
-- u-boot の confiture をしないと image.ub を読みに行ってしまいます
-- mkdir -p images/linux/ をしないと uImage などがコピーできないというエラーが出ます
+以下のようにしたところ、、、SD カードの ext4 パーティションを
+マウントできなくなってしまいました。
+
+ General setup --->
+ Cross-compiler tool prefix = arm-linux-gnueabihf-
+ [Uncheck] Initial RAM filesystem and RAM disk (initramfs/initrd) support
+ Bus support --->
+ [Uncheck] PCI support
+ Kernel Features --->
+ Maximum number of CPUs = 2
+ Power management options --->
+ [Uncheck] Suspend to RAM and standby
+ [Uncheck] Device power management core functionality
+ Device Drivers --->
+ Generic Driver Options --->
+ [ ] Prevent firmware from being built
+ Default contiguous memory area size
+ Size in Mega Bytes = 64
+ Device Tree and Open Firmware support --->
+ [Check] Device Tree overlays
+ SCSI device support --->
+ [Uncheck] SCSI device support
+ Input device support --->
+ [Uncheck] Mice
+ Character devices --->
+ <M> Xillybus generic FPGA interface
+ <M> Xillybus over Device Tree
+ I2C support --->
+ I2C Hardware Bus support --->
+ <M> Xilinx I2C Controller
+ SPI support --->
+ <M> Xilinx SPI controller common module
+ <M> Xilinx Zynq QSPI controller
+ [*] Xilinx Zynq QSPI Dual stacked configuration
+ GPIO Support --->
+ I2C GPIO expanders --->
+ <M> PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports
+ <M> Sound card support
+ HID support --->
+ <M> Generic HID driver
+ Special HID drivers --->
+ <M> Microsoft non-fully HID-compliant devices
+ USB HID support --->
+ <M> USB HID transport layer
+ USB support --->
+ <M> Support for Host-side USB
+ <M> USB Gadget Support
+ Userspace I/O drivers --->
+ <M> Userspace platform driver with generic irq and dynamic memory
+ FPGA Configuration Support --->
+ <M> FPGA Configuration Framework
+ <M> Xilinx Zynq FPGA
+
+arch/arm/boot/Image のサイズは
+- petalinux のデフォルト設定で 9640864
+- ramdisk, PCI bus, Power management, SCSI support を消したところ 9617760~
+全然変わらない(^^;~
+しかも mmcblk0p2 をマウントできなくなりました。
+- 調べるの面倒なので、削除する方向はなしにして、必要なものを追加することにします。
+- 下記をすべて追加したところ 9636832 になりました。あれ?減ってる???
+
+ General setup --->
+ Cross-compiler tool prefix = arm-linux-gnueabihf-
+ Device Drivers --->
+ Generic Driver Options --->
+ [ ] Prevent firmware from being built
+ Default contiguous memory area size
+ Size in Mega Bytes = 64
+ Device Tree and Open Firmware support --->
+ [Check] Device Tree overlays
+ Character devices --->
+ <M> Xillybus generic FPGA interface
+ <M> Xillybus over Device Tree
+ I2C support --->
+ I2C Hardware Bus support --->
+ <M> Xilinx I2C Controller
+ SPI support --->
+ <M> Xilinx SPI controller common module
+ <M> Xilinx Zynq QSPI controller
+ [*] Xilinx Zynq QSPI Dual stacked configuration
+ GPIO Support --->
+ I2C GPIO expanders --->
+ <M> PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports
+ <M> Sound card support
+ HID support --->
+ <M> Generic HID driver
+ Special HID drivers --->
+ <M> Microsoft non-fully HID-compliant devices
+ USB HID support --->
+ <M> USB HID transport layer
+ USB support --->
+ <M> Support for Host-side USB
+ <M> USB Gadget Support
+ Userspace I/O drivers --->
+ <M> Userspace platform driver with generic irq and dynamic memory
+ FPGA Configuration Support --->
+ <M> FPGA Configuration Framework
+ <M> Xilinx Zynq FPGA